{ "metadata": { "name": "", "signature": "sha256:87cf6450e408068d2b64d3d679656b6e6d607d01a7dfae921950b1720a70da2c" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Pivot Tables\n", "\n", "In this chapter we will learn how to use pivot tables in Pandas.\n", "\n", "They are useful for breaking down datasets and providing individual views that we can compare.\n", "\n", "## Tasks\n", "\n", "1. We want to know how many complaints of each type there are in each month.\n", "1. We want to know how many complaints of each type there are in each borough.\n", "1. We want to know how many complaints of each type there are in each borough in each location type\n", "\n", "* There are too many complaint types, so probably it makes sense to focus only on the top 5 or 10.\n", "* It is also nice to know the releative distribution: so instead of the raw numbers, we want to see the percentages.\n", "* We want a total row as well.\n", "\n", "## Tutorial\n", "\n", "* We follow the tutorial in \n", " \n", "* [Local version with small adaptations and data](http://nbviewer.ipython.org/url/maartenmarx.nl/teaching/ISatWork/NoteBooks/Pandas-Pivot-Table-Explained.ipynb)" ] }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }